import { defineStore } from 'pinia'

export const useColumnSettingStore = defineStore('columnSettingStore', {
  state: () => {
    return {
      org: [
        {
          prop: 'code',
          label: '组织编码',
          show: true,
          width: 140,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'name',
          label: '组织名称',
          show: true,
          width: 140,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'fullCode',
          label: '组织及以下所有编码',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'state',
          label: '组织状态',
          show: true,
          width: 140,
          sortable: false,
          fixed: false,
          formatter: 'enableFormat'
        },
        {
          prop: 'orderNum',
          label: '显示顺序',
          show: true,
          width: 140,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createBy',
          label: '创建者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createTime',
          label: '创建时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        },
        {
          prop: 'updateBy',
          label: '更新者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'updateTime',
          label: '更新时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        }
      ],
      role: [
        {
          prop: 'name',
          label: '角色名称',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'state',
          label: '角色状态',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'stateFormat'
        },
        {
          prop: 'createBy',
          label: '创建者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createTime',
          label: '创建时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        },
        {
          prop: 'updateBy',
          label: '更新者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'updateTime',
          label: '更新时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        }
      ],
      user: [
        {
          prop: 'nickname',
          label: '用户昵称',
          show: true,
          width: 150,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'state',
          label: '状态',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'userStateFormat'
        },
        {
          prop: 'mobile',
          label: '联系电话',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'gender',
          label: '性别',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'genderFormat'
        },
        {
          prop: 'birthday',
          label: '年龄',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'ageFormat'
        },
        {
          prop: 'avatar',
          label: '头像',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createBy',
          label: '创建者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createTime',
          label: '创建时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        },
        {
          prop: 'updateBy',
          label: '更新者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'updateTime',
          label: '更新时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        }
      ],
      dictType: [
        {
          prop: 'typeValue',
          label: '字典类型',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'typeLabel',
          label: '字典类型标签',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'state',
          label: '字典类型状态',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'stateFormat'
        },        
        {
          prop: 'remark',
          label: '备注',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createBy',
          label: '创建者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createTime',
          label: '创建时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        },
        {
          prop: 'updateBy',
          label: '更新者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'updateTime',
          label: '更新时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        }
      ],
      dictData: [
        {
          prop: 'dataLabel',
          label: '字典数据标签',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'typeValue',
          label: '字典类型',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'dataValue',
          label: '字典数据',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'state',
          label: '字典类型状态',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'stateFormat'
        },
        {
          prop: 'orderNum',
          label: '显示顺序',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'remark',
          label: '备注',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'defaultFlag',
          label: '是否默认',
          show: true,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: 'yesFormat'
        },
        {
          prop: 'createBy',
          label: '创建者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'createTime',
          label: '创建时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        },
        {
          prop: 'updateBy',
          label: '更新者',
          show: false,
          width: undefined,
          sortable: false,
          fixed: false,
          formatter: undefined
        },
        {
          prop: 'updateTime',
          label: '更新时间',
          show: true,
          width: 165,
          sortable: false,
          fixed: false,
          formatter: 'dateFormat'
        }
      ]
    }
  },
  actions: {
    setVal(key, val) {
      this[key] = val
    }
  },
  persist: true
  // persist: {
  //   enabled: true,
  //   strategies: [
  //     { key: 'device', storage: localStorage, paths: ['device'] },
  //     { key: 'org', storage: localStorage, paths: ['org'] },
  //   ],
  // },
})

export default useColumnSettingStore
